package com.book.upms.ip.hystrix;

import com.book.common.result.RestResponse;
import com.book.common.result.PageInfo;
import com.book.upms.ip.dto.BlackIpDto;
import com.book.upms.ip.vo.BlackIpVo;
import com.book.upms.ip.hystrix.impl.BlackIpHystrixImpl;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * Description：IP黑名单 Hystrix
 *
 * @Author： leo
 * @CreateDate： 2020-12-31
 * @Email： leo.xiong@suyun360.com
 * Version: 1.0
 */
@FeignClient(value = "upms-public", fallbackFactory = BlackIpHystrixImpl.class)
public interface IBlackIpHystrix {
    /**
     * 根据ID获取IP黑名单信息
     *
     * @param id
     * @return
     */
    @GetMapping(value = "/public/blackIp/{id}", consumes = "application/json")
    RestResponse<BlackIpVo> get(@PathVariable(value = "id") String id);

    /**
     * 查询IP黑名单信息
     *
     * @param blackIpDto
     * @return
     */
    @PostMapping(value = "/public/blackIp/list", consumes = "application/json")
    RestResponse<List<BlackIpVo>> list(@RequestBody BlackIpDto blackIpDto);

    /**
     * 查询IP黑名单信息
     *
     * @param blackIpDto
     * @return
     */
    @PostMapping(value = "/public/blackIp/page/list", consumes = "application/json")
    RestResponse<PageInfo<BlackIpVo>> pageList(@RequestBody BlackIpDto blackIpDto);

    /**
     * 新增IP黑名单信息
     *
     * @param blackIpDto
     * @return
     */
    @PostMapping(value = "/public/blackIp/save", consumes = "application/json")
    RestResponse<String> save(@RequestBody BlackIpDto blackIpDto);

    /**
     * 修改IP黑名单信息
     *
     * @param blackIpDto
     * @return
     */
    @PutMapping(value = "/public/blackIp/update", consumes = "application/json")
    RestResponse<String> update(@RequestBody BlackIpDto blackIpDto);

    /**
     * 删除IP黑名单信息
     *
     * @param id
     * @return
     */
    @DeleteMapping(value = "/public/blackIp/delete/{id}", consumes = "application/json")
    RestResponse<String> delete(@PathVariable(value = "id") String id);

    /**
     * 导出IP黑名单模板信息
     *
     * @return
     */
    @PostMapping(value = "/public/blackIp/export/template", consumes = "application/json")
    RestResponse<String> exportTemplate();

    /**
     * 导出IP黑名单信息
     *
     * @param blackIpDto
     * @return
     */
    @PostMapping(value = "/public/blackIp/export/excel", consumes = "application/json")
    RestResponse<String> exportExcel(@RequestBody BlackIpDto blackIpDto);

    /**
     * 导入IP黑名单信息
     *
     * @param filePath
     * @return
     */
    @PostMapping(value = "/public/blackIp/import/excel", consumes = "application/json")
    RestResponse<String> importExcel(@RequestParam(value = "filePath") String filePath);

}
